﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    
                    xmlns:view="clr-namespace:UserNotification.View"
                    >

  <SolidColorBrush x:Key="NormalBorderBrush" Color="Black" />
  <SolidColorBrush x:Key="DefaultedBorderBrush" Color="Black" />

  <SolidColorBrush x:Key="DisabledForegroundBrush" Color="#888" />

  <SolidColorBrush x:Key="DisabledBackgroundBrush" Color="#EEE" />

  <SolidColorBrush x:Key="DisabledBorderBrush" Color="#AAA" />

  <LinearGradientBrush x:Key="CloseNormal" StartPoint="0.5,0" EndPoint="0.5,1">
    <GradientStop Color="#394452" Offset="0.0"/>
    <GradientStop Color="#343e4a" Offset="1.0"/>
  </LinearGradientBrush>

  <LinearGradientBrush x:Key="CloseOver" StartPoint="0.5,0" EndPoint="0.5,1">
    <GradientStop Color="#515a6b" Offset="0.0"/>
    <GradientStop Color="#474f5d" Offset="1.0"/>
  </LinearGradientBrush>

  <SolidColorBrush x:Key="ClosePressed" Color="#090909" />

  <BitmapImage x:Key="Image_Close_Button" UriSource="pack://application:,,,/UserNotification;component/Resources/close.png"/>

  <Style x:Key="ButtonFocusVisual">
    <Setter Property="Control.Template">
      <Setter.Value>
        <ControlTemplate>
          <Border>
            <Rectangle Margin="2"
                       StrokeThickness="1"
                       Stroke="#60000000"
                       StrokeDashArray="1 2"/>
          </Border>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- This style defines the visual of the close button in the notification window -->
  <Style TargetType="{x:Type view:NotificationCloseButton}" BasedOn="{StaticResource {x:Type Button}}">
    <Setter Property="SnapsToDevicePixels" Value="true"/>
    <Setter Property="FocusVisualStyle" Value="{DynamicResource ButtonFocusVisual}"/>
    <Setter Property="MinHeight" Value="16"/>
    <Setter Property="MinWidth" Value="16"/>
    <Setter Property="Cursor" Value="Hand"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Button}">
          <Grid>
            <Border x:Name="Border" CornerRadius="3" BorderThickness="0"
                    ClipToBounds="False"
                    Background="{DynamicResource CloseNormal}"
                    BorderBrush="{DynamicResource NormalBorderBrush}">
              <Border.Effect>
                <DropShadowEffect ShadowDepth="0" Opacity=".4" BlurRadius="5" Color="Black"/>
              </Border.Effect>
              <Grid>
                <Image Source="{DynamicResource Image_Close_Button}" IsHitTestVisible="False" Margin="2">
                  <Image.Effect>
                    <DropShadowEffect Direction="90" ShadowDepth="1" BlurRadius="1"/>
                  </Image.Effect>
                </Image>
                <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" RecognizesAccessKey="True"/>
              </Grid>
            </Border>
          </Grid>
          <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter TargetName="Border" Property="Background" Value="{DynamicResource CloseOver}" />
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
              <Setter TargetName="Border" Property="Background" Value="{DynamicResource ClosePressed}" />
            </Trigger>
            <Trigger Property="IsKeyboardFocused" Value="true">
              <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource DefaultedBorderBrush}" />
            </Trigger>
            <Trigger Property="IsDefaulted" Value="true">
              <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource DefaultedBorderBrush}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
              <Setter TargetName="Border" Property="Background" Value="{DynamicResource DisabledBackgroundBrush}" />
              <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource DisabledBorderBrush}" />
              <Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
</ResourceDictionary>